﻿namespace HRM.CORE
{
    using APP.HELPER.Data.Helper;
    using DevExpress.XtraEditors;
    using System; using Extra.ERP;
    using System.ComponentModel;
    using System.Data;
    using System.Data.SqlClient;
    using System.Windows.Forms; using Common;

    public class HRM_SALARY_MINUS
    {
        private string m_Description;
        private string m_EmployeeCode;
        private bool m_IsIncomeTax;
        private decimal m_Money;
        private Guid m_SalaryMinusID;
        private string m_SalaryMinusName;
        private Guid m_SalaryTableListID;

        public HRM_SALARY_MINUS()
        {
            this.m_SalaryTableListID = Guid.Empty;
            this.m_EmployeeCode = "";
            this.m_SalaryMinusID = Guid.Empty;
            this.m_SalaryMinusName = "";
            this.m_Money = 0M;
            this.m_IsIncomeTax = false;
            this.m_Description = "";
        }

        public HRM_SALARY_MINUS(Guid SalaryTableListID, string EmployeeCode, Guid SalaryMinusID, string SalaryMinusName, decimal Money, bool IsIncomeTax, string Description)
        {
            this.m_SalaryTableListID = SalaryTableListID;
            this.m_EmployeeCode = EmployeeCode;
            this.m_SalaryMinusID = SalaryMinusID;
            this.m_SalaryMinusName = SalaryMinusName;
            this.m_Money = Money;
            this.m_IsIncomeTax = IsIncomeTax;
            this.m_Description = Description;
        }

        public string Delete()
        {
            string[] myParams = new string[] { "@SalaryTableListID", "@EmployeeCode" };
            object[] myValues = new object[] { this.m_SalaryTableListID, this.m_EmployeeCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_SALARY_MINUS_Delete", myParams, myValues);
        }

        public string Delete(Guid SalaryTableListID, string EmployeeCode)
        {
            string[] myParams = new string[] { "@SalaryTableListID", "@EmployeeCode" };
            object[] myValues = new object[] { SalaryTableListID, EmployeeCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_SALARY_MINUS_Delete", myParams, myValues);
        }

        public string Delete(SqlConnection myConnection, Guid SalaryTableListID, string EmployeeCode)
        {
            string[] myParams = new string[] { "@SalaryTableListID", "@EmployeeCode" };
            object[] myValues = new object[] { SalaryTableListID, EmployeeCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myConnection, "HRM_SALARY_MINUS_Delete", myParams, myValues);
        }

        public string Delete(SqlTransaction myTransaction, Guid SalaryTableListID, string EmployeeCode)
        {
            string[] myParams = new string[] { "@SalaryTableListID", "@EmployeeCode" };
            object[] myValues = new object[] { SalaryTableListID, EmployeeCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "HRM_SALARY_MINUS_Delete", myParams, myValues);
        }

        private void DispError(object sender, SqlHelperException e)
        {
            XtraMessageBox.Show(e.Message, "Th\x00f4ng B\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }

        public bool Exist(Guid SalaryTableListID, string EmployeeCode, string SalaryMinusID)
        {
            bool hasRows = false;
            string[] myParams = new string[] { "@SalaryTableListID", "@EmployeeCode", "@SalaryMinusID" };
            object[] myValues = new object[] { SalaryTableListID, EmployeeCode, SalaryMinusID };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader("HRM_SALARY_MINUS_Get", myParams, myValues);
            if (reader != null)
            {
                hasRows = reader.HasRows;
                reader.Close();
                helper.Close();
                reader = null;
            }
            return hasRows;
        }

        public string Get(Guid SalaryTableListID, string EmployeeCode, string SalaryMinusID)
        {
            string str = "";
            string[] myParams = new string[] { "@SalaryTableListID", "@EmployeeCode", "@SalaryMinusID" };
            object[] myValues = new object[] { SalaryTableListID, EmployeeCode, SalaryMinusID };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader("HRM_SALARY_MINUS_Get", myParams, myValues);
            if (reader != null)
            {
                while (reader.Read())
                {
                    this.m_SalaryTableListID = reader.GetGuid(reader.GetOrdinal("SalaryTableListID"));
                    this.m_EmployeeCode = Convert.ToString(reader["EmployeeCode"]);
                    this.m_SalaryMinusID = reader.GetGuid(reader.GetOrdinal("SalaryMinusID"));
                    this.m_SalaryMinusName = Convert.ToString(reader["SalaryMinusName"]);
                    this.m_Money = Convert.ToDecimal(reader["Money"]);
                    this.m_IsIncomeTax = Convert.ToBoolean(reader["IsIncomeTax"]);
                    this.m_Description = Convert.ToString(reader["Description"]);
                    str = "OK";
                }
                reader.Close();
                helper.Close();
                reader = null;
            }
            return str;
        }

        public string Get(SqlConnection myConnection, Guid SalaryTableListID, string EmployeeCode, string SalaryMinusID)
        {
            string str = "";
            string[] myParams = new string[] { "@SalaryTableListID", "@EmployeeCode", "@SalaryMinusID" };
            object[] myValues = new object[] { SalaryTableListID, EmployeeCode, SalaryMinusID };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader(myConnection, "HRM_SALARY_MINUS_Get", myParams, myValues);
            if (reader != null)
            {
                while (reader.Read())
                {
                    this.m_SalaryTableListID = reader.GetGuid(reader.GetOrdinal("SalaryTableListID"));
                    this.m_EmployeeCode = Convert.ToString(reader["EmployeeCode"]);
                    this.m_SalaryMinusID = reader.GetGuid(reader.GetOrdinal("SalaryMinusID"));
                    this.m_SalaryMinusName = Convert.ToString(reader["SalaryMinusName"]);
                    this.m_Money = Convert.ToDecimal(reader["Money"]);
                    this.m_IsIncomeTax = Convert.ToBoolean(reader["IsIncomeTax"]);
                    this.m_Description = Convert.ToString(reader["Description"]);
                    str = "OK";
                }
                reader.Close();
                helper.Close();
                reader = null;
            }
            return str;
        }

        public string Get(SqlTransaction myTransaction, Guid SalaryTableListID, string EmployeeCode, string SalaryMinusID)
        {
            string str = "";
            string[] myParams = new string[] { "@SalaryTableListID", "@EmployeeCode", "@SalaryMinusID" };
            object[] myValues = new object[] { SalaryTableListID, EmployeeCode, SalaryMinusID };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader(myTransaction, "HRM_SALARY_MINUS_Get", myParams, myValues);
            if (reader != null)
            {
                while (reader.Read())
                {
                    this.m_SalaryTableListID = reader.GetGuid(reader.GetOrdinal("SalaryTableListID"));
                    this.m_EmployeeCode = Convert.ToString(reader["EmployeeCode"]);
                    this.m_SalaryMinusID = reader.GetGuid(reader.GetOrdinal("SalaryMinusID"));
                    this.m_SalaryMinusName = Convert.ToString(reader["SalaryMinusName"]);
                    this.m_Money = Convert.ToDecimal(reader["Money"]);
                    this.m_IsIncomeTax = Convert.ToBoolean(reader["IsIncomeTax"]);
                    this.m_Description = Convert.ToString(reader["Description"]);
                    str = "OK";
                }
                reader.Close();
                helper.Close();
                reader = null;
            }
            return str;
        }

        public DataTable GetList(Guid SalaryTableListID, string EmployeeCode)
        {
            string[] myParams = new string[] { "@SalaryTableListID", "@EmployeeCode" };
            object[] myValues = new object[] { SalaryTableListID, EmployeeCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("HRM_SALARY_MINUS_GetList", myParams, myValues);
        }

        public string Insert()
        {
            string[] myParams = new string[] { "@SalaryTableListID", "@EmployeeCode", "@SalaryMinusID", "@SalaryMinusName", "@Money", "@IsIncomeTax", "@Description" };
            object[] myValues = new object[] { this.m_SalaryTableListID, this.m_EmployeeCode, this.m_SalaryMinusID, this.m_SalaryMinusName, this.m_Money, this.m_IsIncomeTax, this.m_Description };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_SALARY_MINUS_Insert", myParams, myValues);
        }

        public string Insert(SqlTransaction myTransaction)
        {
            string[] myParams = new string[] { "@SalaryTableListID", "@EmployeeCode", "@SalaryMinusID", "@SalaryMinusName", "@Money", "@IsIncomeTax", "@Description" };
            object[] myValues = new object[] { this.m_SalaryTableListID, this.m_EmployeeCode, this.m_SalaryMinusID, this.m_SalaryMinusName, this.m_Money, this.m_IsIncomeTax, this.m_Description };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "HRM_SALARY_MINUS_Insert", myParams, myValues);
        }

        public string Insert(Guid SalaryTableListID, string EmployeeCode, Guid SalaryMinusID, string SalaryMinusName, decimal Money, bool IsIncomeTax, string Description)
        {
            string[] myParams = new string[] { "@SalaryTableListID", "@EmployeeCode", "@SalaryMinusID", "@SalaryMinusName", "@Money", "@IsIncomeTax", "@Description" };
            object[] myValues = new object[] { SalaryTableListID, EmployeeCode, SalaryMinusID, SalaryMinusName, Money, IsIncomeTax, Description };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_SALARY_MINUS_Insert", myParams, myValues);
        }

        public string Insert(SqlConnection myConnection, Guid SalaryTableListID, string EmployeeCode, Guid SalaryMinusID, string SalaryMinusName, decimal Money, bool IsIncomeTax, string Description)
        {
            string[] myParams = new string[] { "@SalaryTableListID", "@EmployeeCode", "@SalaryMinusID", "@SalaryMinusName", "@Money", "@IsIncomeTax", "@Description" };
            object[] myValues = new object[] { SalaryTableListID, EmployeeCode, SalaryMinusID, SalaryMinusName, Money, IsIncomeTax, Description };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myConnection, "HRM_SALARY_MINUS_Insert", myParams, myValues);
        }

        public string Insert(SqlTransaction myTransaction, Guid SalaryTableListID, string EmployeeCode, Guid SalaryMinusID, string SalaryMinusName, decimal Money, bool IsIncomeTax, string Description)
        {
            string[] myParams = new string[] { "@SalaryTableListID", "@EmployeeCode", "@SalaryMinusID", "@SalaryMinusName", "@Money", "@IsIncomeTax", "@Description" };
            object[] myValues = new object[] { SalaryTableListID, EmployeeCode, SalaryMinusID, SalaryMinusName, Money, IsIncomeTax, Description };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "HRM_SALARY_MINUS_Insert", myParams, myValues);
        }

        public string Update()
        {
            string[] myParams = new string[] { "@SalaryTableListID", "@EmployeeCode", "@SalaryMinusID", "@SalaryMinusName", "@Money", "@IsIncomeTax", "@Description" };
            object[] myValues = new object[] { this.m_SalaryTableListID, this.m_EmployeeCode, this.m_SalaryMinusID, this.m_SalaryMinusName, this.m_Money, this.m_IsIncomeTax, this.m_Description };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_SALARY_MINUS_Update", myParams, myValues);
        }

        public string Update(SqlTransaction myTransaction)
        {
            string[] myParams = new string[] { "@SalaryTableListID", "@EmployeeCode", "@SalaryMinusID", "@SalaryMinusName", "@Money", "@IsIncomeTax", "@Description" };
            object[] myValues = new object[] { this.m_SalaryTableListID, this.m_EmployeeCode, this.m_SalaryMinusID, this.m_SalaryMinusName, this.m_Money, this.m_IsIncomeTax, this.m_Description };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "HRM_SALARY_MINUS_Update", myParams, myValues);
        }

        public string Update(Guid SalaryTableListID, string EmployeeCode, Guid SalaryMinusID, string SalaryMinusName, decimal Money, bool IsIncomeTax, string Description)
        {
            string[] myParams = new string[] { "@SalaryTableListID", "@EmployeeCode", "@SalaryMinusID", "@SalaryMinusName", "@Money", "@IsIncomeTax", "@Description" };
            object[] myValues = new object[] { SalaryTableListID, EmployeeCode, SalaryMinusID, SalaryMinusName, Money, IsIncomeTax, Description };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_SALARY_MINUS_Update", myParams, myValues);
        }

        public string Update(SqlConnection myConnection, Guid SalaryTableListID, string EmployeeCode, Guid SalaryMinusID, string SalaryMinusName, decimal Money, bool IsIncomeTax, string Description)
        {
            string[] myParams = new string[] { "@SalaryTableListID", "@EmployeeCode", "@SalaryMinusID", "@SalaryMinusName", "@Money", "@IsIncomeTax", "@Description" };
            object[] myValues = new object[] { SalaryTableListID, EmployeeCode, SalaryMinusID, SalaryMinusName, Money, IsIncomeTax, Description };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myConnection, "HRM_SALARY_MINUS_Update", myParams, myValues);
        }

        public string Update(SqlTransaction myTransaction, Guid SalaryTableListID, string EmployeeCode, Guid SalaryMinusID, string SalaryMinusName, decimal Money, bool IsIncomeTax, string Description)
        {
            string[] myParams = new string[] { "@SalaryTableListID", "@EmployeeCode", "@SalaryMinusID", "@SalaryMinusName", "@Money", "@IsIncomeTax", "@Description" };
            object[] myValues = new object[] { SalaryTableListID, EmployeeCode, SalaryMinusID, SalaryMinusName, Money, IsIncomeTax, Description };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "HRM_SALARY_MINUS_Update", myParams, myValues);
        }

        [DisplayName("Description"), Category("Column")]
        public string Description
        {
            get
            {
                return this.m_Description;
            }
            set
            {
                this.m_Description = value;
            }
        }

        [Category("Primary Key"), DisplayName("EmployeeCode")]
        public string EmployeeCode
        {
            get
            {
                return this.m_EmployeeCode;
            }
            set
            {
                this.m_EmployeeCode = value;
            }
        }

        [DisplayName("IsIncomeTax"), Category("Column")]
        public bool IsIncomeTax
        {
            get
            {
                return this.m_IsIncomeTax;
            }
            set
            {
                this.m_IsIncomeTax = value;
            }
        }

        [DisplayName("Money"), Category("Column")]
        public decimal Money
        {
            get
            {
                return this.m_Money;
            }
            set
            {
                this.m_Money = value;
            }
        }

        [Category("Primary Key"), DisplayName("SalaryMinusID")]
        public Guid SalaryMinusID
        {
            get
            {
                return this.m_SalaryMinusID;
            }
            set
            {
                this.m_SalaryMinusID = value;
            }
        }

        [Category("Column"), DisplayName("SalaryMinusName")]
        public string SalaryMinusName
        {
            get
            {
                return this.m_SalaryMinusName;
            }
            set
            {
                this.m_SalaryMinusName = value;
            }
        }

        [DisplayName("SalaryTableListID"), Category("Primary Key")]
        public Guid SalaryTableListID
        {
            get
            {
                return this.m_SalaryTableListID;
            }
            set
            {
                this.m_SalaryTableListID = value;
            }
        }
    }
}

